[LegacyColorValue = true]; 

{ Dynamic Mom Index
  Copyright 1997-1999, P.J.Kaufman. All rights reserved.
  This technique is adapted from Tushar Chande and Stanley Kroll, The New Market Technician (John Wiley & Sons, NY, 1994)
  It creates a dynamic, variable-length RSI using the changes in price, rather than the price itself.

  Corrects sustained periods where the oscillator has high or low values
  by adjusting by the current trend }

	input:	momlen(14), len1(5), len2(10);
	vars:		DMItoday(0), vlty(0);

	vlty = (summation(absvalue(close - close[1]),len1)) /
				(average(summation(absvalue(close - close[1]),len1),len2));
	DMItoday = IntPortion(momlen / vlty);
	plot1 (DMItoday,"DMI");
